{template "header.html"}

<script src="{THEME_PATH}assets/js/echarts.min.js"></script>
<link href="{THEME_PATH}assets/global/plugins/bootstrap-daterangepicker/daterangepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css" />
<script src="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.finecms.js" type="text/javascript"></script>

<script type="text/javascript">
    if (App.isAngularJsApp() === false) {
        jQuery(document).ready(function() {
            if (jQuery().datepicker) {
                $('.date-picker').datepicker({
                    rtl: App.isRTL(),
                    orientation: "left",
                    autoclose: true
                });
            }
        });
    }
</script>

<div class="row table-search-tool">
    <form action="{SELF}" method="get">
        {dr_form_search_hidden()}
        <div class="col-md-12 col-sm-12">
            {loop $select $i $t}
            <label> <a href="{dr_url(APP_DIR.'/home/fenxi_index')}&tid={$i}" class="btn {if $i == $tid} btn-success{else}btn-default{/if}">{$t}</a> </label>
            {/loop}
        </div>

        <div class="col-md-12 col-sm-12">
            <label>
                <div class="input-group input-medium date-picker input-daterange" data-date="" data-date-format="yyyy-mm-dd">
                    <input type="text" class="form-control" value="{$date_form}" name="date_form">
                    <span class="input-group-addon"> {dr_lang('到')} </span>
                    <input type="text" class="form-control" value="{$date_to}" name="date_to">
                </div>
            </label>
        </div>

        <div class="col-md-12 col-sm-12">
            <label><button type="submit" class="btn green btn-sm onloading" name="submit" > <i class="fa fa-search"></i> {dr_lang('查询')}</button></label>
        </div>
    </form>
</div>

<div class="row">
    <div class="col-md-6">
        <div class="portlet light bordered">
            <div class="portlet-title">
                <div class="caption">
                    <span class="caption-subject bold uppercase font-green-haze"> 爬虫统计</span>
                </div>
            </div>
            <div class="portlet-body">
                <div id="zzt" style="height:400px;"></div>
                <script>
                    var myChart = echarts.init(document.getElementById('zzt'));
                    var option = {
                        title : {
                            text: '蜘蛛爬行次数统计',
                            subtext: '{dr_date($stime, 'Y-m-d')} ~ {dr_date($etime, 'Y-m-d')}',
                            x:'center'
                        },
                        tooltip : {
                            trigger: 'item',
                            formatter: "{a} <br/>{b} : {c} ({d}%)"
                        },
                        legend: {
                            orient: 'vertical',
                            left: 'left',
                            data: {$zzt.name}
                    },
                    series : [
                        {
                            name: '蜘蛛',
                            type: 'pie',
                            radius : '55%',
                            center: ['50%', '60%'],
                            data:{$zzt.data},
                    itemStyle: {
                        emphasis: {
                            shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    }
                    }
                    ]
                    };
                    myChart.setOption(option);

                </script>
            </div>
        </div>
    </div>
    <div class="col-md-6">
        <div class="portlet light bordered">
            <div class="portlet-title">
                <div class="caption">
                    <span class="caption-subject bold uppercase font-green-haze"> 时间段统计</span>
                </div>
            </div>
            <div class="portlet-body">

                <div id="sjdtj" style="height:400px;"></div>
               <script type="text/javascript">
                   var myChart = echarts.init(document.getElementById('sjdtj'));
                   // 指定图表的配置项和数据
                   var option = {
                       title: {
                           text: '{dr_date($stime, 'Y-m-d')} ~ {dr_date($etime, 'Y-m-d')}'
                       },
                       tooltip: {},
                       legend: {
                           data:['']
                       },
                       xAxis: {
                           data: {$sjd.name}
                       },
                       yAxis: {},
                       series: [{
                           name: '本时间段的爬行统计',
                           type: 'bar',
                           data: {$sjd.data}
                       }]
                   };
                   myChart.setOption(option);
                </script>


            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <div class="portlet light bordered">
            <div class="portlet-title">
                <div class="caption">
                    <span class="caption-subject bold uppercase font-green-haze"> 抓取排行</span>
                </div>
            </div>
            <div class="portlet-body">
                <div class="table-scrollable">
                <table class="table table-striped table-bordered table-hover table-checkable dataTable">
                    <thead>
                    <tr class="heading">
                        <th width="160" class="{dr_sorting('inputtime')}" name="inputtime">{dr_lang('时间')}</th>
                        <th class="{dr_sorting('title')}" name="title">{dr_lang('标题')}</th>
                        <th class="{dr_sorting('url')}" name="url">{dr_lang('地址')}</th>
                        <th>{dr_lang('抓取次数')}</th>
                    </tr>
                    </thead>
                    <tbody>
                    {loop $list $t}
                    <tr class="odd gradeX" id="dr_row_{$t.id}">
                        <td>{dr_date($t.inputtime, null, 'red')}</td>
                        <td>{dr_list_function('title', $t.title, $param, $t)}</td>
                        <td>{$t.url}</td>
                        <td><a href="{dr_url(APP_DIR.'/home/index', ['field'=>'url', 'keyword' => urlencode($t.url)])}">{$t.counts}</a></td>
                    </tr>
                    {/loop}
                    </tbody>
                </table>
            </div>
            </div>
        </div>
    </div>
</div>

{template "footer.html"}